<template>
    <!--为echarts准备一个具备大小的容器dom-->
    <div id="main" style="width: 1500px;height: 700px;"></div>
</template>
<script>
    import echarts from 'echarts'
    export default {
        name: 'PersonWeek',
        methods:{
            drawPie(id){
                this.charts = echarts.init(document.getElementById(id))
                this.charts.setOption({
                    title: {
                        text: '博主每周发布时间段（以最高人气博主为例）'
                    },
                    legend: {},
                    tooltip: {},
                    dataset: {
                        source: [
                            ['time', '周一', '周二', '周三','周四', '周五', '周六','周日'],
                            ['发布数', 2, 0, 0,0,0,1,2],
                        ]
                    },
                    xAxis: {type: 'category'},
                    yAxis: {},
                    series: [
                        {type: 'bar'},
                        {type: 'bar'},
                        {type: 'bar'},
                        {type: 'bar'},
                        {type: 'bar'},
                        {type: 'bar'},
                        {type: 'bar'}
                    ]
                })
            }
        },
        //调用
        mounted(){
            this.$nextTick(function() {
                this.drawPie('main')
            })
        }
    }
</script>
<style scoped>
    * {
        margin: 0;
        padding: 0;
        list-style: none;
    }
</style>
